#ifndef ascii_h
#define ascii_h

// this header needs
#include "wchar.h"

// ascii is a simple encoding with a number of characters equal to
// the maximum number that can be expressed in 7 binary digits
// therefore is very simple and useful (for english)
// https://en.wikipedia.org/wiki/ASCII

#define OWL_MIN_ASCII 0x00
#define OWL_MAX_ASCII 0x7F
#define OWL_INV_ASCII 0xFF
#define OWL_INV_ASCII_STR     "[INV_ASCII_INT]"
#define OWL_INV_ENC_ASCII_STR "[INV_ENC_ASCII]"

// needed definition for unicode functions
#define OWL_INV_UNICODE 0xFFFFFF

// character constants (wchar.h)
owl_wchar OWL_ASCII_NUM[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                             'A', 'B', 'C', 'D', 'E', 'F',
                             'a', 'b', 'c', 'd', 'e', 'f',
                             '+', '-', '.', 'X', 'x'};
owl_wchar OWL_ASCII_WSP[] = {'\t', '\n', '\v', '\f', '\r', ' '};
owl_wchar OWL_ASCII_PATH[] = {'/', '\\', '.'};
owl_wchar OWL_ASCII_LETR[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 
                              'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
                              'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 
                              'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
#define OWL_ASCII_NULL 0x00

// basic functions
owl_byte owl_check_wchar_ascii(owl_wchar ch);
owl_byte owl_check_wchar_enc_ascii(owl_byte * src, owl_umax size);
owl_wchar owl_get_wchar_ascii(owl_byte * src, owl_umax size);
owl_byte * owl_write_wchar_enc_ascii(owl_wchar ch, owl_byte * dest, owl_umax size);
owl_byte owl_print_wchar_ascii(owl_wchar ch);
owl_byte owl_print_wchar_enc_ascii(owl_byte * src, owl_umax size);

#include "ascii.c"

// conversion to unicode
// for the conversión I'll just provide an array whose indexes represent
// the encoding character integer and the array element is the unicode
// integer value. Full array 0 partitions. Yeah, space waste, but I dont care.
// I will only care about integers in these functions so yeah 2 functions only
owl_wchar owl_wchar_ascii_as_unicode(owl_wchar ascii);
owl_wchar owl_wchar_unicode_as_ascii(owl_wchar unicode);

#include "ascii_unicode.c"

#endif // ascii_h
